package com.yand.thinkingInJava.thinkingInJava21;




public class ListOff implements Runnable {

    protected  int countDown = 10;




    //静态变量 所有线程共享一个
    private static int taskCount = 0;


    private final int id = taskCount++;


    public ListOff(){

    }

    public ListOff(int countDown) {
        this.countDown = countDown;
    }


    public String status(){
        return "#"+id+"("+(countDown > 0 ? countDown:"Listoff!")+").";
    }



    @Override
    public void run() {
        while(countDown-- > 0){
            System.out.print(status());
            Thread.yield();

        }
    }
}
